#ifndef DRAGGINGRESIZERSTRATEGY_H
#define DRAGGINGRESIZERSTRATEGY_H


#if defined (_WIN32)
	#pragma once
#endif

#include <LDF/VisComponentStrategy.h>
#include "../../ToolkitLayer.h"

/**
 * This strategy implements resizing by dragging a component. It is important
 * to notice that the actual dimensions of the component are changed by this
 * resizing, instead of only its scale factor.
 *
 * @author Fabricio Anastacio - fabriciocfa@yahoo.com
 * @since August 9, 2007
 */
class TOOLKITLAYER_API DraggingResizerStrategy : public VisComponentStrategy
{
	// Attributes
protected:
	/** Determines when the resize button is being pressed. */
	bool pressed;
	/** The previous x-coordinate of the cursor position. */
	int previousX;
	/** The previous y-coordinate of the cursor position. */
	int previousY;
	/** Minimum width to be set for a component. */
	unsigned int minWidth;
	/** Minimum height to be set for a component. */
	unsigned int minHeight;


	// Methods
public:
	/**
	 * Creates a dragging resizer strategy.
	 */
	DraggingResizerStrategy(void);
	/**
	 * Destroys this strategy.
	 */
	~DraggingResizerStrategy(void);


	// ACCESSOR METHODS
	/**
	 * Returns the value of the minimum width to be set to a component.
	 *
	 * @return the value of the minimum width to be set to a component.
	 */
	inline unsigned int getMinWidth() { return minWidth; };
	/**
	 * Sets the value of the minimum width to be set to a component.
	 *
	 * @param f the value to be used as the minimum width to be set to a
	 * component.
	 */
	inline void setMinWidth(unsigned int w) { minWidth = w; };
	/**
	 * Returns the value of the minimum height to be set to a component.
	 *
	 * @return the value of the minimum height to be set to a component.
	 */
	inline unsigned int getMinHeight() { return minHeight; };
	/**
	 * Sets the value of the minimum height to be set to a component.
	 *
	 * @param f the value to be used as the minimum height to be set to a
	 * component.
	 */
	inline void setMinHeight(unsigned int h) { minHeight = h; };


protected:
	/**
	 * Handles the given event.
	 *
	 * @param evt the event to be handled.
	 */
	void onEvent(LargeDisplayEvent* evt);
	
};

#endif // DRAGGINGRESIZERSTRATEGY_H
